<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            text-align: center;
        }
    </style>
</head>
<body>
    <script>
        function yhsj(sanka){
            var arr=new Array(sanka);
            for(var i=0;i<arr.length;i++){
                arr[i]=new Array(i+1);
            }
            for(var i=0;i<arr.length;i++){
                for(var j=0;j<arr[i].length;j++){
                    if(j===0 || i===j){
                        arr[i][j]=1;
                    }else{
                        arr[i][j]=arr[i-1][j]+arr[i-1][j-1];
                    }
                }
            }
            for(var i=0;i<arr.length;i++){
                for(var j=0;j<arr[i].length;j++){
                    document.write(arr[i][j]+" ");
                }
                document.write("<br/>")
            }
        }
        yhsj(10);
    </script>
</body>
</html>